#pragma once

#include "..\\Messaging\IListener.h"
#include "CBase.h"
#include <vector>
using std::vector;

class CLayer;
class CTeleporter;
class CEnemy;
class CAi;
class CFirewall;
class CTile;
class CLayer;
class CDoor;
class console;


enum OWNER {OWNER_NONE, OWNER_PLAYER, OWNER_AI, OWNER_NUM_OWNERS};
enum N_EFFECT {N_EFFECT_NONE, N_EFFECT_SPEED, N_EFFECT_CAP_RATE, N_EFFECT_MONEY, N_EFFECT_NUM_EFFECTS};

class CNode : public CBase, public IListener
{
	int numEnemiesEffect;
	vector<CEnemy*> enemies;
	vector<CEnemy*> activeEnemies;
	vector<CLayer*> layers;
	vector<CTeleporter*> teleporters;
	vector<CFirewall*> firewalls;
	vector<CDoor*> doors;
	vector<console*> consoles;
	OWNER owner;
	N_EFFECT effect;
	int imageID; // ID for the tileset image
	bool isActive; // true if this node has been "Entered" and should be rendered and updated.
	CAi* ai;	// pointer to the AI

	// Asset IDs
	int m_nTeleportID;

	vector<CTile*> rendTiles;

public:
	//does the player own it and is it hold a connection with home node
	bool isplayerconnected;
	//does the enemy own it and does it hold a connection with the enemy node
	bool isenemyconnected;
	CNode();
	~CNode();
	void PushEnemy(const CEnemy* const pEnemy);
	void PushLayer( CLayer* const pLayer);
	void PushDoor(const CDoor* const pDoor);
	void PushConsole(const console* const console);
	void PushTeleporter(const CTeleporter* const pTeleporter);
	void PushFirewall(const CFirewall* const pFirewall);
	void SpawnEnemies();
	void FlushEnemies();
	void Update(float fElapsedTime);
	void Render();
	void HandleEvent(CEvent* pEvnt);
	void EnterNode();
	void ExitNode();
	
	// Accessors/Mutators
	void SetAI(CAi* AI) {ai = AI;}
	CAi* GetAI() {return ai;}
	void SetIsActive(bool active) {isActive = active;}
	bool GetIsActive() {return isActive;}
	void SetImageID(int ID);
	int GetImageID() {return imageID;}
	void SetOwner(OWNER newOwner);
	OWNER GetOwner() {return owner;}
	void SetEffect(N_EFFECT newEffect) {effect = newEffect;}
	N_EFFECT GetEffect() {return effect;}
	vector<CTeleporter*>* getTeles();

	vector<console*>* getcons();
	vector<CDoor*>* getdoors();

	vector<CLayer*>* getlayers();
	
};

